﻿using DomenModel;
using Infrastructure.Repositories;
using Infrastructure.Service;
using Model.Repositories;
using Model.Repositories.Interfaces;
using Model.Service;
using Ninject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using OmsTestProject.MockRepository;


namespace OmsTestProject
{
    public class MockNinjectDependencyResolver 
    {
        private IKernel kernel;
        public MockNinjectDependencyResolver()
        {
            kernel = new StandardKernel();
            AddBindings();
        }
        public object GetService(Type serviceType)
        {
            return kernel.TryGet(serviceType);
        }
        public IEnumerable<object> GetServices(Type serviceType)
        {
            return kernel.GetAll(serviceType);
        }
        private void AddBindings()
        {
            kernel.Bind<ICrud<CreditCard>>().To<CreditCardRepository>();
            kernel.Bind<IItemCrud>().To<ItemRepository>();
            kernel.Bind<ICrudItemDimension>().To<ItemDimensionRepository>();
            kernel.Bind<ICrud<Order>>().To<OrderRepository>();
            kernel.Bind<IOrderDetailsCrud>().To<OrderDetailsRepository>();
            kernel.Bind<ICrud<Role>>().To<RoleRepository>();
            kernel.Bind<ICrud<Status>>().To<StatusRepository>();
            kernel.Bind<IUserCrud>().To<UserRepository>();
        }
    }
}